package com.ecloud.scheduler.config;

import com.ecloud.common.standard.EnableProp;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @author Squbi
 */
@Configuration
@ConfigurationProperties("scheduler.thread")
@Data
public class SchedulerThreadPoolProperties implements EnableProp {
    private String loadClass;
    private String count;
    private String priority;
    private boolean loaderOfInitializing;

    @Override
    public Properties toProperties() {
        Properties prop = new Properties();
        prop.put("org.quartz.threadPool.class", loadClass);
        prop.put("org.quartz.threadPool.threadCount", count);
        prop.put("org.quartz.threadPool.threadPriority", priority);
        prop.put("org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread", loaderOfInitializing);
        return prop;
    }
}
